home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / pipeline / abacus / p_line / Custom04 / c_Balance next >
Encoding:
Text File  |  1992-10-30  |  2.3 KB  |  110 lines

  1. %OP%VS4.13 (28-Apr-92), Gerald L Fitton, R4000 5966 9904 9938 
  2. %OP%TNN
  3. %OP%WRN
  4. %OP%DP0
  5. %OP%IRN
  6. %OP%PL0
  7. %OP%HM0
  8. %OP%FM0
  9. %OP%BM0
  10. %OP%LM4
  11. %OP%PT1
  12. %OP%PDPipeLine
  13. %OP%WC2,2022,624,1192,0,1,0,2
  14. %OP%NDloop_counter,6
  15. %OP%NDinterest_charged,B34
  16. %OP%NDnew_balance,B36
  17. %OP%NDprevious_balance,B32
  18. %OP%NDinterest_rate,B33
  19. %OP%NDthis_repayment,B35
  20. %OP%NDstarting_balance,B32
  21. %OP%NDend_balance,B36
  22. %OP%FR0,2
  23. %CO:A,38,117%Comments and Commands
  24.  
  25.  
  26. Custom function to find the final balance after making a number
  27.  of fixed payments to pay off a fixed interest loan.
  28.  
  29. %V%%L%function("final_balance","initial_balance:number","no_of_years:number","interest:number","repayment:number")
  30.  
  31. Declare all local variables as names
  32. %V%%L%set_name("starting_balance",B10)
  33. %V%%L%set_name("interest_charged",B11)
  34. %V%%L%set_name("end_balance",B12)
  35.  
  36. Initialise local variables using set_value(name,value)
  37. %V%%L%set_value(end_balance,@initial_balance)
  38.  
  39. %V%%L%for("loop_counter",1,@no_of_years)
  40. %V%%L% set_value(starting_balance,end_balance)
  41. %V%%L% set_value(interest_charged,starting_balance*@interest/100)
  42. %V%%L% set_value(end_balance,starting_balance+interest_charged-@repayment)
  43. %V%%L%next
  44.  
  45. %V%%L%result(end_balance)
  46.  
  47. ------------------------------------------------------------------------
  48.  
  49. Custom function using arrays as input
  50.  
  51. %V%%L%function("final_balance_02","initial_balance:number","no_of_years:number","interest:array","repayment:array")
  52.  
  53. Declare all local variables as names
  54. %V%%L%set_name("starting_balance",B32)
  55. %V%%L%set_name("interest_rate",B33)
  56. %V%%L%set_name("interest_charged",B34)
  57. %V%%L%set_name("this_repayment",B35)
  58. %V%%L%set_name("end_balance",B36)
  59.  
  60. Initialise local variables using set_value(name,value)
  61. %V%%L%set_value(end_balance,@initial_balance)
  62.  
  63. %V%%L%for("loop_counter",1,@no_of_years)
  64. %V%%L% set_value(starting_balance,end_balance)
  65. %V%%L% set_value(interest_rate,index(@interest,1,loop_counter))
  66. %V%%L% set_value(interest_charged,starting_balance*interest_rate/100)
  67. %V%%L% set_value(this_repayment,index(@repayment,1,loop_counter))
  68. %V%%L% set_value(end_balance,starting_balance+interest_charged-this_repayment)
  69. %V%%L%next
  70.  
  71. %V%%L%result(end_balance)
  72.  
  73. ------------------------------------------------------------------------
  74. %CO:B,24,0%%R%Value
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. %V%%R%%LC%22872
  84. %V%%R%%LC%2287.2
  85. %V%%R%%LC%11159.2
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105. %V%%R%%LC%12770
  106. %V%%R%%TC%10
  107. %V%%R%%LC%1277
  108. %V%%R%%LC%14000
  109. %V%%R%%LC%47
  110. %CO:C,10,0%